package com.xiangjiayi.study.controller;

import dev.langchain4j.model.chat.ChatModel;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
public class MultiModelController {
    @Resource(name = "qwen")
    private ChatModel chatModelQwen; //引入的ai模型类资源

    @Resource(name = "deepseek")
    private ChatModel chatModelDeepSeek;

    @GetMapping(value = "/multimodel/qwen")
    public String qwenCall(@RequestParam(value = "prompt",defaultValue = "你是谁")String prompt){
        String result = chatModelQwen.chat(prompt);
        System.out.println("通过langchain4j调用千问模型返回结果："+result);
        return result;
    }

    @GetMapping(value = "/multimodel/deepseek")
    public String deepseekCall(@RequestParam(value = "prompt",defaultValue = "你是谁？")String prompt){
        String result = chatModelDeepSeek.chat(prompt);
        System.out.println("通过langchain4j调用deepseek模型返回："+result);
        return result;
    }


}
